package com.example.movie.api

import com.example.http.CommonHttpRetrofitAnnotation
import com.example.http.RetrofitManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object MovieServerModule {

    /**
     * 通过依赖注入的方式传递进来一个Retrofit对象，然后返回接口实例
     */
    @Provides
    @Singleton
    fun getPlayApiServer(@CommonHttpRetrofitAnnotation retrofit: Retrofit): MovieServerApi = retrofit.create(MovieServerApi::class.java)

}